import 'package:flutter/material.dart';

class XmmStateColor extends MaterialStateColor {
  XmmStateColor(this.defaultColor, {this.pressedColor, this.disabledColor})
      : super(defaultColor);

  final int defaultColor;

  int? pressedColor;

  int? disabledColor;

  @override
  Color resolve(Set<MaterialState> states) {
    if (pressedColor != null && states.contains(MaterialState.pressed)) {
      return Color(pressedColor!);
    }
    if (disabledColor != null && states.contains(MaterialState.disabled)) {
      return Color(disabledColor!);
    }
    return Color(defaultColor);
  }
}
